s = input()
n = len(s)
hash_set = set()
j = 0
i = 0
ans = 0
while j < n:
    while j < n and s[j] in hash_set:
        hash_set.remove(s[i])
        i += 1
    hash_set.add(s[j])
    ans = max(ans, j - i + 1)
    j += 1

print(ans)
